package com.ruoyi.system.mapper;

import java.util.List;
import com.ruoyi.system.domain.BizDeliveryNote;
import com.ruoyi.system.domain.BizDeliveryBatch;

/**
 * 送货单Mapper接口
 * 
 * @author ruoyi
 * @date 2025-10-22
 */
public interface BizDeliveryNoteMapper 
{
    /**
     * 查询送货单
     * 
     * @param deliveryNoteId 送货单主键
     * @return 送货单
     */
    public BizDeliveryNote selectBizDeliveryNoteByDeliveryNoteId(Long deliveryNoteId);

    /**
     * 查询送货单列表
     * 
     * @param bizDeliveryNote 送货单
     * @return 送货单集合
     */
    public List<BizDeliveryNote> selectBizDeliveryNoteList(BizDeliveryNote bizDeliveryNote);

    /**
     * 新增送货单
     * 
     * @param bizDeliveryNote 送货单
     * @return 结果
     */
    public int insertBizDeliveryNote(BizDeliveryNote bizDeliveryNote);

    /**
     * 修改送货单
     * 
     * @param bizDeliveryNote 送货单
     * @return 结果
     */
    public int updateBizDeliveryNote(BizDeliveryNote bizDeliveryNote);

    /**
     * 删除送货单
     * 
     * @param deliveryNoteId 送货单主键
     * @return 结果
     */
    public int deleteBizDeliveryNoteByDeliveryNoteId(Long deliveryNoteId);

    /**
     * 批量删除送货单
     * 
     * @param deliveryNoteIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteBizDeliveryNoteByDeliveryNoteIds(Long[] deliveryNoteIds);

    /**
     * 批量删除送货单批次明细
     * 
     * @param deliveryNoteIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteBizDeliveryBatchByDeliveryNoteIds(Long[] deliveryNoteIds);
    
    /**
     * 批量新增送货单批次明细
     * 
     * @param bizDeliveryBatchList 送货单批次明细列表
     * @return 结果
     */
    public int batchBizDeliveryBatch(List<BizDeliveryBatch> bizDeliveryBatchList);
    

    /**
     * 通过送货单主键删除送货单批次明细信息
     * 
     * @param deliveryNoteId 送货单ID
     * @return 结果
     */
    public int deleteBizDeliveryBatchByDeliveryNoteId(Long deliveryNoteId);
    
    /**
     * 查询当天最大送货单编号（按日期前缀）
     * @param datePrefix 形如 DNyyyyMMdd
     */
    public String selectMaxDeliveryNoteNoByDate(String datePrefix);

    /**
     * 按送货单ID查询其批次明细列表
     */
    public List<BizDeliveryBatch> selectBizDeliveryBatchListByNoteId(Long deliveryNoteId);

    /**
     * 按送货单ID与批次号更新批次状态
     */
    public int updateBizDeliveryBatchStatusByNoteIdAndBatchNo(@org.apache.ibatis.annotations.Param("deliveryNoteId") Long deliveryNoteId,
                                                              @org.apache.ibatis.annotations.Param("batchNo") String batchNo,
                                                              @org.apache.ibatis.annotations.Param("batchStatus") String batchStatus,
                                                              @org.apache.ibatis.annotations.Param("updatedBy") String updatedBy,
                                                              @org.apache.ibatis.annotations.Param("updatedTime") java.util.Date updatedTime);
}
